package com.cr.business.service.impl;

import java.util.Collections;
import java.util.List;

import com.cr.business.domain.vo.LsdSupervisionRankingVo;
import com.cr.common.utils.DateUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.cr.business.mapper.TbSupervisionRankingInfoMapper;
import com.cr.business.domain.TbSupervisionRankingInfo;
import com.cr.business.service.ITbSupervisionRankingInfoService;

/**
 * 网格化监管排名信息Service业务层处理
 * 
 * @author tang
 * @date 2025-10-28
 */
@Service
public class TbSupervisionRankingInfoServiceImpl implements ITbSupervisionRankingInfoService 
{
    @Resource
    private TbSupervisionRankingInfoMapper tbSupervisionRankingInfoMapper;

    /**
     * 查询网格化监管排名信息
     * 
     * @param id 网格化监管排名信息主键
     * @return 网格化监管排名信息
     */
    @Override
    public TbSupervisionRankingInfo selectTbSupervisionRankingInfoById(Long id)
    {
        return tbSupervisionRankingInfoMapper.selectTbSupervisionRankingInfoById(id);
    }

    /**
     * 查询网格化监管排名信息列表
     * 
     * @param tbSupervisionRankingInfo 网格化监管排名信息
     * @return 网格化监管排名信息
     */
    @Override
    public List<TbSupervisionRankingInfo> selectTbSupervisionRankingInfoList(TbSupervisionRankingInfo tbSupervisionRankingInfo)
    {
        return tbSupervisionRankingInfoMapper.selectTbSupervisionRankingInfoList(tbSupervisionRankingInfo);
    }

    /**
     * 新增网格化监管排名信息
     * 
     * @param tbSupervisionRankingInfo 网格化监管排名信息
     * @return 结果
     */
    @Override
    public int insertTbSupervisionRankingInfo(TbSupervisionRankingInfo tbSupervisionRankingInfo)
    {
        tbSupervisionRankingInfo.setCreateTime(DateUtils.getNowDate());
        return tbSupervisionRankingInfoMapper.insertTbSupervisionRankingInfo(tbSupervisionRankingInfo);
    }

    /**
     * 修改网格化监管排名信息
     * 
     * @param tbSupervisionRankingInfo 网格化监管排名信息
     * @return 结果
     */
    @Override
    public int updateTbSupervisionRankingInfo(TbSupervisionRankingInfo tbSupervisionRankingInfo)
    {
        tbSupervisionRankingInfo.setUpdateTime(DateUtils.getNowDate());
        return tbSupervisionRankingInfoMapper.updateTbSupervisionRankingInfo(tbSupervisionRankingInfo);
    }

    /**
     * 批量删除网格化监管排名信息
     * 
     * @param ids 需要删除的网格化监管排名信息主键
     * @return 结果
     */
    @Override
    public int deleteTbSupervisionRankingInfoByIds(Long[] ids)
    {
        return tbSupervisionRankingInfoMapper.deleteTbSupervisionRankingInfoByIds(ids);
    }

    /**
     * 删除网格化监管排名信息信息
     * 
     * @param id 网格化监管排名信息主键
     * @return 结果
     */
    @Override
    public int deleteTbSupervisionRankingInfoById(Long id)
    {
        return tbSupervisionRankingInfoMapper.deleteTbSupervisionRankingInfoById(id);
    }

    @Override
    public List<LsdSupervisionRankingVo> getLsdList() {
        List<LsdSupervisionRankingVo> lsdSupervisionRankingVos = tbSupervisionRankingInfoMapper.selectTop10();
        int seq = 1;
        for (LsdSupervisionRankingVo lsdSupervisionRankingVo : lsdSupervisionRankingVos) {
            lsdSupervisionRankingVo.setSeq(seq ++);
        }
        return lsdSupervisionRankingVos;
    }
}
